package day07;

import java.util.Random;

//需求；生成？位验证码(大写字母，小写字母，数字)
public class VerificationCode {
    public static void main(String[] args) {
        String code = generateVeriCode(50000000);
        System.out.println("验证码："+code);
    }
    //生成验证码
    public static String generateVeriCode(int len){
        String code="";
        char[] chs={'q','w','e','r','t','y','u','i',
                'o','p','a','s','d','f','g','h','j','k',
                'l','z','x','c','v','b','n','m','0','1',
                'Q','W','E','R','T','Y','U','I','O','P','A','S','D','F',
               'G','H','J','K','L','Z','X','C','B','N','M','V',
                '2','3','4','5','6','7','8','9',};
        Random rand = new Random();
        for (int i=1; i<=len;i++){
            int index =rand.nextInt(chs.length);{
            code += chs[index];
            }
        }







        /*
        for (int i=1;i<=len;i++){
            int index = (int)(Math.random()* chs.length);
            code += chs[index];
        }

         */
        return code;
    }
}
